const info = {}
const search = window.location.search.replace('?', '');

search.split('&').forEach(el => {
  const i = el.split('=');
  info[i[0]] = i[1];
});

const socket = io.connect('http://localhost:3000');

socket.on('connect', function () {
  console.info('connect')
  socket.emit('online', info.client);
});

socket.on('news', function (params) {
  console.info(params)
});

// document.querySelector('#btn-send').addEventListener('click', () => {
//   socket.emit('news', {
//     receiver: info.receiver,
//     content: 'hello from ' + info.user
//   })
// })